<div id="layout_main_top">

</div>
<div id="layout_main">


{if !isset($errormessage)}


<form action="index.php?page=panel" method="post">
<INPUT TYPE=HIDDEN NAME="action" value="save">
<INPUT TYPE=HIDDEN NAME="player_id" value={$player.player_id}>
  <table id="small_table" cellspacing='0'>
    <tr class="menu_header">
  	<th colspan='3'>
  	{if isset($player)}Edit{else}New{/if} Character
  	</th>
  	</tr>

  	<tr class="row_1">
	<td colspan='3' class="staticboldcenter">
	Please insert the following information:<br><span class="error">{$errormessage}</span><br>
	</td>
	</tr>
  	<tr class="row_1">
		<td class="staticboldright">
		<br>
		</td>
		<td class="autonormaltop">
		<br>
		</td>
		<td class="autonormaltopright" width="16px">
		<br>
		</td>
	</tr>
  	<tr class="row_1">
		<td class="staticboldright">
			Name:

			{if isset($name_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$name_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
		<td class="autonormalcenter">
			<input type="text" id="name" class="largetext" name="name" value="{$player.name}">
		</td>
		<td class="autonormal">
			{if isset($name_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$name_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
	</tr>
  	<tr class="row_1">
		<td class="staticboldright">
			Class:
			{if isset($class_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$class_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
		<td class="autonormalcenter">
			{html_options options=$classes name="class" class="large" selected=$player.class_id}
		</td>
		<td class="autonormal">
			{if isset($class_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$class_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
	</tr>
	
  	<tr class="row_1">
		<td class="staticboldright">
			Role:

			{if isset($role_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$role_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
		<td class="autonormalcenter">
		<select name="role" class="large">
			{foreach name=class_roles_for item=class_role from=$class_roles}	
				<option label="{$class_role.class_role_name}" value="{$class_role.id}" {if $class_role.id eq $player.class_role_id}SELECTED{/if}>{$class_role.class_role_name}</option>
			{foreachelse}
					<option label="none" value="0">None</option>
			{/foreach}
		</select>
		</td>
		<td class="autonormal">
			{if isset($race_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$race_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
	</tr>
	
  	<tr class="row_1">
		<td class="staticboldright">
			Race:

			{if isset($race_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$race_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
		<td class="autonormalcenter">
			{html_options options=$races name="race" class="large" selected=$player.race}
		</td>
		<td class="autonormal">
			{if isset($race_error)}
				<img src="./images/buttons/icon-error.png" width="16px" height="16px" {popup text=$race_error   center=#overlib_center# wrap=true offsety=#overlib_offsety# fgcolor=#overlib_fgcolor# bgcolor=#overlib_bgcolor#  textcolor=#overlib_textcolor#}></img>
			{/if}
		</td>
	</tr>

	
	{foreach name=categories item=attribute_categorie from=$attribute_categories}

	<tr class="row_1">
		<td class="staticboldright">
			{$attribute_categorie.name}:
		</td>
		<td class="autonormalcenter">

    <input type="hidden" name="update{$attribute_categorie.id}" id="update{$attribute_categorie.id}" value="{if isset($attributes[$player.player_id][$attribute_categorie.id])}1{else}0{/if}">
    <input type="hidden" name="attriplayer{$attribute_categorie.id}" id="attriplayer{$attribute_categorie.id}" value="{$attributes[$player.player_id][$attribute_categorie.id].id}">

	{if $attribute_categorie.type eq '1'}
			<input type="checkbox" id="attri{$attribute_categorie.id}" class="checkbox" name="attri{$attribute_categorie.id}" {if isset($attributes[$player.player_id][$attribute_categorie.id])}{if $attributes[$player.player_id][$attribute_categorie.id].value eq 1}checked{/if}{/if}>
	{elseif $attribute_categorie.type eq '2'}
            <input type="text" id="attri{$attribute_categorie.id}" class="smalltext" name="{$attribute_categorie.short_name}" value="{if isset($attributes[$attribute_categorie.id][$player.player_id.player_id])}{$attributes[$attribute_categorie.id][$player.player_id].value}{else}0{/if}">
	{/if}
		</td>
		<td class="autonormal">

		</td>
	</tr>
	{/foreach}

  	<tr class="row_1">
		<td class="staticboldright">
		<br>
		</td>
		<td class="autonormalbottom">
		<br>
		</td>
		<td class="autonormalbottomright">
		&nbsp;
		</td>
	</tr>
	<tr class="row_1">
		<td class="staticboldcenter" colspan="3">
		<br>
		<input name="newchar" type="submit" value="Save Character">
		</td>
	</tr>


 </table>
</form>

{else}



<DIV class="MenuHead">
Succesfull!
</DIV>

<DIV class="MenuText">
{$message}
</DIV>




{/if}

</div>
<div id="layout_main_bottom">

</div>